@@ -41,12 +41,12 @@ module ApplicationHelper |
||
41 | 41 |
end |
42 | 42 |
end |
43 | 43 |
|
44 |
- def icon_for_service(service) |
|
45 |
- case service.to_sym |
|
44 |
+ def omniauth_provider_icon(provider) |
|
45 |
+ case provider.to_sym |
|
46 | 46 |
when :twitter, :tumblr, :github |
47 |
- "<i class='fa fa-#{service}'></i>".html_safe |
|
47 |
+ content_tag :i, '', class: "fa fa-#{provider}" |
|
48 | 48 |
else |
49 |
- "<i class='fa fa-lock'></i>".html_safe |
|
49 |
+ content_tag :i, '', class: "fa fa-lock" |
|
50 | 50 |
end |
51 | 51 |
end |
52 | 52 |
end |
@@ -121,23 +121,23 @@ describe ApplicationHelper do |
||
121 | 121 |
end |
122 | 122 |
end |
123 | 123 |
|
124 |
- describe '#icon_for_service' do |
|
124 |
+ describe '#omniauth_provider_icon' do |
|
125 | 125 |
it 'returns a correct icon tag for Twitter' do |
126 |
- icon = icon_for_service(:twitter) |
|
126 |
+ icon = omniauth_provider_icon(:twitter) |
|
127 | 127 |
expect(icon).to be_html_safe |
128 | 128 |
elem = Nokogiri(icon).at('i.fa.fa-twitter') |
129 | 129 |
expect(elem).to be_a Nokogiri::XML::Element |
130 | 130 |
end |
131 | 131 |
|
132 | 132 |
it 'returns a correct icon tag for GitHub' do |
133 |
- icon = icon_for_service(:github) |
|
133 |
+ icon = omniauth_provider_icon(:github) |
|
134 | 134 |
expect(icon).to be_html_safe |
135 | 135 |
elem = Nokogiri(icon).at('i.fa.fa-github') |
136 | 136 |
expect(elem).to be_a Nokogiri::XML::Element |
137 | 137 |
end |
138 | 138 |
|
139 | 139 |
it 'returns a correct icon tag for other services' do |
140 |
- icon = icon_for_service(:'37signals') |
|
140 |
+ icon = omniauth_provider_icon(:'37signals') |
|
141 | 141 |
expect(icon).to be_html_safe |
142 | 142 |
elem = Nokogiri(icon).at('i.fa.fa-lock') |
143 | 143 |
expect(elem).to be_a Nokogiri::XML::Element |